package com.team.coupon.api.factory;

import com.team.common.core.web.domain.AjaxResult;
import com.team.coupon.api.RemoteCouponService;
import com.team.coupon.api.domain.BizCoupon;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 优惠券服务远程调用降级处理
 */
@Component
public class RemoteCouponFallbackFactory implements FallbackFactory<RemoteCouponService> {
    @Override
    public RemoteCouponService create(Throwable cause) {
        return new RemoteCouponService() {
            @Override
            public AjaxResult listCoupons() {
                return null;
            }

            @Override
            public AjaxResult addCoupons(BizCoupon bizCoupon) {
                return null;
            }

            @Override
            public AjaxResult updateCoupon(BizCoupon bizCoupon) {
                return null;
            }

            @Override
            public AjaxResult deleteCoupon(Long bizCouponId) {
                return null;
            }

            @Override
            public AjaxResult getCouponByEntityId(Long entityId) {
                return null;
            }

            @Override
            public AjaxResult getCouponById(Long id) {
                return null;
            }
            // 这里可以实现每个方法的降级逻辑，简单返回null或默认值
        };
    }
} 